<?php

use think\migration\Migrator;

class ChatRoleAddWelcome extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    protected string $name = 'chat_role';

    public function change(): void
    {
        $table = $this->table($this->name);
        $table->addColumn('welcome', 'string', [
            'limit' => 255, 'default' => '', 'comment' => '欢迎语', 'after' => 'intro'
        ])->addColumn('questions', 'string', [
            'limit' => 500, 'default' => '', 'comment' => '问题模板', 'after' => 'welcome'
        ])->addColumn('placeholder', 'string', [
            'limit' => 250, 'default' => '', 'comment' => '输入框提示语', 'after' => 'questions'
        ])->save();
    }
}
